<template>

  <div class="view">
    <div class="container">
      <div class="item">
        <image class="img" src="~@/static/home/person.png" />
        <div class="name">{{info.username|| ''}}</div>
      </div>
      <div class="item" @click="logout">
        <image class="img" src="~@/static/home/logout.png" />
        退出
      </div>
    </div>

    <div class="welcome">
      欢迎使用数·智阅读生态体系服务系统!
    </div>

    <div class="content">
      <div class="item" v-for="item in menus" v-alive="1" @click="toPage(item.path)">
        <div class="left">
          <image :src="item.icon" />
          <span class="text">{{item.text}}</span>
        </div>
        <u-icon name="arrow-right" size="18"></u-icon>
      </div>
    </div>
  </div>
</template>

<script setup>
import { navigate } from "@/util/navigate";
import { request,catchException } from "@/util/request";
import { onLoad } from '@dcloudio/uni-app'
import { ref } from "vue";
// 获取static/home/menus/下的静态图片
const modules = import.meta.glob("../../static/home/menus/*", { eager: true });

function getAssetsImages(name) {
  return modules[`../../static/home/menus/${name}`].default;
}
const menus = [{
  text: '活动报名',
  icon: getAssetsImages('1.png'),
  id: 1
}]

function toPage(){
  navigate({url: '/pages/activity/index'})
}

function logout(){
  navigate({url: '/pages/login/index',navMethod: 'reLaunch'})
}
const info = ref({
  username:''
})
onLoad(()=>{
  info.value = uni.getStorageSync('userToken_zh_web')
  request({url:'adminMobile/index/index'}).then(res =>{

  }).catch(e => catchException(e))
})



</script>

<style lang="scss" scoped>
page {
  background: #f3f3f3;
}
.view {
  padding: 30rpx;
  .container {
    display: flex;
    justify-content: space-between;
    .img {
      width: 40rpx;
      height: 40rpx;
    }
    .item {
      display: flex;
      align-items: center;
      gap: 12rpx;

      .name {
        font-size: 40rpx;
        font-family: PingFang SC, PingFang SC-Bold;
        font-weight: 700;
        text-align: center;
        color: #333333;
        line-height: 44rpx;
      }
    }
  }
  .welcome {
    margin-top: 12rpx;
    font-size: 28rpx;
    font-family: PingFang SC, PingFang SC-Medium;
    font-weight: 500;
    text-align: left;
    color: #333333;
  }
}

.content {
  display: flex;
  flex-direction: column;
  gap: 30rpx;
  margin-top: 48rpx;
  .item {
    display: flex;
    justify-content: space-between;
    background: #fff;
    border-radius: 16rpx;
    padding: 38rpx 30rpx;
    .left {
      display: flex;
      align-items: center;
      gap: 24rpx;
      image {
        width: 80rpx;
        height: 80rpx;
      }
      .text {
        font-size: 30rpx;
        font-family: PingFang SC, PingFang SC-Bold;
        font-weight: 700;
        color: #333333;
      }
    }
  }
}
</style>